﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using BUSINESS_OBJECT;

namespace CRM.admin
{
    public partial class CUSTOMER : System.Web.UI.Page
    {
        Custcls custmr = new Custcls();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dt = custmr.GetRecords(-99, "", "", "", "", -99, "", Convert.ToDateTime( "1/1/1800"), -99,"", "", "", "","","", false, " and ");
                GridView1.DataSource = dt;
                GridView1.DataBind();

            }

        }



        protected void DTNDELETE_Click(object sender, CommandEventArgs e)
        {

        }

        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "delete")
            {
                DataTable dt = custmr.GetRecords(Convert.ToInt64(e.CommandArgument.ToString()), "", "", "", "", -99, "", Convert.ToDateTime( "1/1/1800"), -99, "", "", "", "","","", false, " and ");
                custmr.CID = Convert.ToInt64(dt.Rows[0]["CID"].ToString());
                custmr.CUSTOMER_NAME = dt.Rows[0]["CUSTOMER_NAME"].ToString();
                custmr.COMPANY_NAME = dt.Rows[0]["COMPANY_NAME"].ToString();
                custmr.COMPANY_ADDRESS = dt.Rows[0]["COMPANY_ADDRESS"].ToString();
                custmr.SERVICE_TYPE = dt.Rows[0]["SERVICE_TYPE"].ToString();
                custmr.PHONE_NO = Convert.ToInt64(dt.Rows[0]["PHONE_NO"].ToString());
                custmr.CC_TYPE = dt.Rows[0]["CC_TYPE"].ToString();
                custmr.CC_EXR_DATE =Convert.ToDateTime(dt.Rows[0]["CC_EXR_DATE"].ToString());
                custmr.CC_NUMBER = Convert.ToInt64(dt.Rows[0]["CC_NUMBER"].ToString());
                custmr.CC_PINCODE = Convert.ToInt64(dt.Rows[0]["CC_PINCODE"].ToString());
                custmr.EMAIL_ID = dt.Rows[0]["EMAIL_ID"].ToString();
                custmr.CUSER_NAME = dt.Rows[0]["CUSER_NAME"].ToString();
                custmr.CPASSWORD = dt.Rows[0]["CPASSWORD"].ToString();
                custmr.ISDELETED = true;

                custmr.SaveRecords();

                Response.Redirect("CUSTOMER.aspx");
            }

        }


    }
}
